package com.taoye.thread;

public class Demo17 {
	public static void main(String[] args) {
		System.out.println("main线程的优先级为："+Thread.currentThread().getPriority());
		/*
		 * 线程类提供了3个常量来对应优先级的取值
		 * Thread.MIN_PRIORITY = 1 代表优先级最小
		 * Thread.NORM_PRIORITY = 5 默认优先级，所有线程创建优先级都为5
		 * Thread.MAX_PRIORITY = 10 最大优先级
		 */
		Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
		System.out.println("main线程的优先级为："+Thread.currentThread().getPriority());
		Demo17Thread t = new Demo17Thread();
		t.setName("A");
		t.start();
	}
}

class Demo17Thread extends Thread {
	@Override
	public void run() {
		System.out.println("A线程的优先级为："+Thread.currentThread().getPriority());
	}
}